<?php
Yii::import('Cms.components.widgets.BaseCmsWidgetLayout');
class GenericViewDefaultLayout extends BaseCmsWidgetLayout {
    
    /**
    * @return string HTML output
    */
    public function render(){
        $viewPath = $this->getViewPath();
        
        return $this->owner->render($viewPath, array('data' => $this->data[0]), true);
    }    
    
    public function getViewPath(){
        $modelPath = $this->owner->getContentModel();
        if (empty($modelPath))
            return '';
            
        list($module,$folder,$model) = explode('.', $modelPath);
        $view = "{$module}.views.admin.{$model}._view";

        return $view;                
    }    
}